GrassBlock = class(Block)

function GrassBlock:init(id,tex,destoryTime)
    Block.init(self,id,tex,destoryTime)
end

function GrassBlock:getTex(face)
    if face==Top then return 0 end
    if face==Bottom then return 2 end
    return 1
end

function GrassBlock:tick(x,y,z)
    if world:getBrightness(x,y,z) >= 7 then
        for i = 1,4 do
            local xt = x + math.floor(math.random(-2,2))
            local yt = y + math.floor(math.random(-2,2))
            local zt = z + math.floor(math.random(-2,2))
            if world:getBlock(xt,yt,zt) == Block.soil.id and world:isAirBlock(xt,yt + 1,zt) and world:getBrightness(xt,yt,zt) >= 7 then
                world:setBlock(xt,yt,zt,Block.grass.id)
            end
        end
    else
        world:setBlock(x,y,z,Block.soil.id)
    end
end

function GrassBlock:getDroppedItem()
    return Block.soil
end